//
//  FoodClassCell.m
//  dyseller
//
//  Created by 红喇叭 on 2017/11/21.
//  Copyright © 2017年 红喇叭. All rights reserved.
//

#import "FoodClassCell.h"

@implementation FoodClassCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self initView];
    }
    return self;
}


- (void)initView{
    _foodClassName = [[UILabel alloc] init];
    _foodClassName.textColor = UIColorFromRGB(0x333333);
    _foodClassName.font = font15;
    [self.contentView addSubview:_foodClassName];
    _foodClassName.sd_layout.leftSpaceToView(self.contentView, GETWITH(30)).topSpaceToView(self.contentView, 15).widthIs(150).heightIs(16);
    
    _foodNum = [[UILabel alloc] init];
    _foodNum.textColor = UIColorFromRGB(0x999999);
    _foodNum.font = font11;
    [self.contentView addSubview:_foodNum];
    _foodNum.sd_layout.leftEqualToView(_foodClassName).topSpaceToView(_foodClassName, 10).widthIs(150).heightIs(12);
    
    _upClassBtn = [[UIButton alloc] init];
    _upClassBtn.titleLabel.font = font15;
    [_upClassBtn setBackgroundImage:[UIImage imageNamed:@"edit_button3_default_nor"] forState:UIControlStateNormal];
    [_upClassBtn setTitle:@"增加商品" forState:UIControlStateNormal];
    [_upClassBtn setTitleColor:MianRedColor forState:UIControlStateNormal];
    [self.contentView addSubview:_upClassBtn];
    _upClassBtn.sd_layout.rightSpaceToView(self.contentView, GETWITH(30)).centerYEqualToView(self.contentView).
    widthIs(GETWITH(200)).heightIs(30);
    
    
    _editBtn = [[UIButton alloc] init];
    _editBtn.titleLabel.font = font15;
    [_editBtn setBackgroundImage:[UIImage imageNamed:@"edit_button3_default_nor"] forState:UIControlStateNormal];
    [_editBtn setTitle:@"编辑" forState:UIControlStateNormal];
    [_editBtn setTitleColor:MianRedColor forState:UIControlStateNormal];
    [self.contentView addSubview:_editBtn];
    _editBtn.sd_layout.rightSpaceToView(_upClassBtn, GETWITH(20)).centerYEqualToView(self.contentView).
    widthIs(GETWITH(140)).heightIs(30);
    
}

- (void)setDatamModel:(CategoryListModel *)datamModel{
    _datamModel = datamModel;
    _foodClassName.text = _datamModel.category_name;
    _foodNum.text = [NSString stringWithFormat:@"%@个商品",_datamModel.goodsNum];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
